/**
 * ipassbook 0.6.0
 * Copyright (C)2009 wateray and contributors
 * wateray@gmail.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package com.wateray.ipassbook.persistence.sqlmapdao;

import java.util.List;
import java.util.Map;

import com.ibatis.dao.client.DaoManager;
import com.wateray.ipassbook.domain.Passbook;
import com.wateray.ipassbook.domain.PassbookDetail;
import com.wateray.ipassbook.domain.form.PassbookForm;
import com.wateray.ipassbook.persistence.iface.PassbookDao;

/**
 * @author wateray
 * @create 2009-5-23
 */
public class PassbookSqlMapDao extends BaseSqlMapDao implements PassbookDao {

	public PassbookSqlMapDao(DaoManager daoManager) {
		super(daoManager);
		// TODO Auto-generated constructor stub
	}
	
	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.persistence.iface.PassbookDao#getPassbookById(java.lang.String)
	 */
	@Override
	public Passbook getPassbookById(String passbookId) {
		// TODO Auto-generated method stub
		return (Passbook)queryForObject("getPassbookById", passbookId);
	}

	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.persistence.iface.PassbookDao#getPassbookList()
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<Passbook> getPassbookList() {
		// TODO Auto-generated method stub
		 return queryForList("getPassbookList");
	}

	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.persistence.iface.PassbookDao#insertPassbook()
	 */
	@Override
	public int insertPassbook(Passbook passbook) {
		// TODO Auto-generated method stub
		return update("insertPassbook", passbook);
	}

	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.persistence.iface.PassbookDao#insertPassbookDetail()
	 */
	@Override
	public int insertPassbookDetail(PassbookDetail passbookDetail) {
		// TODO Auto-generated method stub
		return update("insertPassbookDetail", passbookDetail);
	}

	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.persistence.iface.PassbookDao#updatePassbook()
	 */
	@Override
	public int updatePassbook(Passbook passbook) {
		// TODO Auto-generated method stub
		return update("updatePassbook", passbook);
	}

	@Override
	public int updatePassbookDetail(PassbookDetail passbookDetail) {
		// TODO Auto-generated method stub
		return update("updatePassbookDetail", passbookDetail);
	}
	
	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.persistence.iface.PassbookDao#deletePassbook()
	 */
	@Override
	public int deletePassbook(Passbook passbook) {
		// TODO Auto-generated method stub
		return update("deletePassbook", passbook);
	}
	
	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.persistence.iface.PassbookDao#getMaxId()
	 */
	@Override
	public String getPassbookMaxId() {
		// TODO Auto-generated method stub
		return (String)queryForObject("getPassbookMaxId");
	}
	
	/* (non-Javadoc)
	 * @see com.wateray.ipassbook.persistence.iface.PassbookDao#getSubMaxId()
	 */
	@Override
	public String getPassbookDetailMaxId(String passbookId) {
		// TODO Auto-generated method stub
		return (String)queryForObject("getPassbookDetailMaxId", passbookId);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<PassbookForm> getPassbookFormList(String languageId) {
		// TODO Auto-generated method stub
		 return queryForList("getPassbookFormList", languageId);
	}

	@Override
	public int updatePassbookDetailBalance(PassbookDetail passbookDetail) {
		// TODO Auto-generated method stub
		return update("updatePassbookDetailBalance", passbookDetail);
	}

	@Override
	public PassbookDetail getPassbookDetailById(Map<String, String> map) {
		// TODO Auto-generated method stub
		return (PassbookDetail)queryForObject("getPassbookDetailById", map);
	}

}
